<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file="DataLoad.asp"-->

<html>
<head>
<title><%=GuildName%> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="DKP WOW GUILD">
<meta name="Description" content="">
<link href="<%=StylePath%>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<%=StylePath%>/styleplus.js"></script>
<style type="text/css" media="all">

</style>
<script type=text/javascript>
</script>

</head>

<body>

<div class="header">
<!--#include file="menu.asp"-->
</div>
<div class="main">
<%
			if not Isnumeric(request("id")) then Response.Redirect URL
			select case Request("action")
			case "confirm"
			Call RaidReportEnd(request("id"))
			case else
			Call confirm()
			end select

			'人员DKP
			%>
</div>
<div id="footer"><!--#include file="footer.asp"--></div>
</body>
</html>
<%
Sub confirm()
	Response.write "<table class='outframe'>"
	Response.write "<tr><th>将活动归档</th></tr>"
	Response.write "<tr><td>活动一旦归档就无法再做任何修改,依照目前报告得出的DKP将被累加到每个成员的基础分上,此后生成的DKP详表将不显示此次活动.</td></tr>"
	Response.write "<tr><td>确定要归档这个活动报告吗?</td></tr>"
	Response.write "<tr><td><b>注意:你无法撤销这个操作!</b></td></tr>"
	Response.write "<tr><td><a href='?action=confirm&id="&Request("id")&"' class='abtn3'>是的,我要归档.</a> <a href='/' class='abtn2'>取消并返回</a></td></tr>"
	Response.write "</table>"
End Sub


Sub RaidReportEnd(id)
	Dim raid_actiontime
	'标记Raid归档
	sql="select * from raid where id="&id
	rs.open sql,conn,1,3
		if rs("raid_step")>1 then 
		Response.write "内部错误C0013"
		exit sub
		end if
		rs("raid_step")=3
		raid_actiontime=rs("raid_actiontime")
		raid_class=rs("raid_class")
	rs.update
	rs.close

	'累计分数 , 参加次数+1
	sql="select * from dkplist where raidid="&id
	rs.open sql,conn,1,1
	for i = 1 to rs.recordcount
		conn.execute("update player_dkp set player_BaseDKP=player_BaseDKP+"&rs("dkp")&" where raid_class="&raid_class&" and player_id="&rs("playerid"))
		conn.execute("update player set player_raidnum=player_raidnum+1 where id="&rs("playerid"))
	rs.movenext
	next
	rs.close
	'删除Raid在DKPLIST中的条目
	conn.execute("Delete * from dkplist where raidid="&id)
	
	'公会活动次数+1
	conn.execute("Update guild set guild_raidnum=guild_raidnum+1")

	'获得装备写入
	sql="select * from raid_event where event_raidid="&id&" and event_class='拾取' "
	rs.open sql,conn,1,1
	for i = 1 to rs.recordcount
	conn.execute("Update player set player_looted=player_looted+'|"&rs("event_object2")&"' where id="&cint(rs("event_object")))
	rs.movenext
	next
	rs.close

	response.redirect "admin_report.asp"
End Sub


%>